<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;


use App\Models\Useradmin;

class StudentModel extends Authenticatable
{
    use HasApiTokens, HasFactory, Notifiable;

    protected $table = 'studentnum';

    /**
     * 可批量分配的属性。.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'name',
        'studentid',
        'phone',
        'house',
        'breakruleid',
        'password',
        'created_at',
        'updated_at'
    ];

    public function getManage()
    {
        return $this->hasOne(ManageModel::class);
    }

    public function toClass()
    {
        return $this->belongsToMany(ClassModel::class,'studentnum_classnum','studentid','classid');
    }
}
